<template>
  <!--pages/login/index.wxml-->
  <view class="apply_box">
    <mineNavbar :styleData="styleData"></mineNavbar>
    <view class="c_box">
      <view class="b_top">
        <image :src="enterpriseDetail.url" mode="scaleToFill" />
        <view class="right">
          <view class="top">{{ enterpriseDetail.fullName || '' }}</view>
          <view class="bottom">
            <text>{{ enterpriseDetail.industrySector || '' }} </text>
            <text class="text">|</text>
            <text>{{ enterpriseDetail.enterpriseNature || '' }} </text>
            <text class="text">|</text>
            <text>{{ enterpriseDetail.enterpriseScale || '' }}</text>
          </view>
        </view>
      </view>
      <view class="b_bottom">
        <text>{{ enterpriseDetail.provinceLabel || '' }}-{{ enterpriseDetail.cityLabel }}-{{ enterpriseDetail.areaLabel
        }}</text>
      </view>
    </view>
    <scroll-view class="a_contain" v-if="applyList.length" scroll-y @scrolltolower="scrollBottomFn">
      <workType :workTypeValue="applyList"></workType>
      <view class="downLoad">-- 加载完成，共{{ applyList.length }}条数据 --</view>
    </scroll-view>
    <noneState v-else></noneState>
  </view>
</template>
  
<script>

import { entHomePage } from "@/api/pages/mine.js"
import noneState from '@/pages/recruit/components/noneState.vue'
import workType from "@/pages/recruit/home/workType/index.vue";

export default {
  components: { noneState, workType },
  data() {
    return {
      styleData: {
        show: true,
        tabbarText: '企业主页'
      },
      pageSize: 10,
      pageNum: 1,
      pageTotal: 1,
      activeType: 1,
      applyList: [],
      enterpriseId: '',
      enterpriseDetail: {}
    };
  },
  computed: {},
  watch: {},
  async onLoad(options) {
    this.enterpriseId = options.enterpriseId
    this.getMyLookListFun()
  },
  async onShow() {
    this.pageNum = 1
    this.enterpriseDetail = uni.getStorageSync('enterpriseDetail')
    console.log(this.enterpriseDetail);
  },
  onReady() { },
  methods: {
    //获取我的收藏列表
    getMyLookListFun() {
      entHomePage({ enterpriseId: this.enterpriseId }).then((res) => {
        if (res.code == 200) {
          this.pageTotal = Math.ceil(res.total / this.pageSize)
          if (this.pageNum === 1) {
            this.applyList = res.rows
          } else {
            res.rows.forEach((suc) => {
              this.applyList.push(suc)
            })
          }
        }
      })
    },
    // 监听滑动到底部
    scrollBottomFn() {
      this.pageNum += 1
      if (this.pageNum <= this.pageTotal) {
        this.getMyLookListFun()
      } else {
        uni.showToast({
          title: '没有更多了',
        });
      }
    },
    // 跳转详情页
    goDetail(item) {
      uni.navigateTo({
        url:
          "/pages/recruit/post/postDetail/index?positionId=" + item.positionId + '&positionType=' + this.positionType,
      });
    }
  },
};
</script>
<style lang="scss" scoped>
.apply_box {
  width: 100%;
  height: 100vh;

  .c_box {
    width: 702rpx;
    height: 220rpx;
    padding: 24rpx;
    box-sizing: border-box;
    background: #fff;
    border-radius: 16rpx;
    margin: 24rpx;

    .b_top {
      display: flex;
      align-items: center;

      >image {
        width: 80rpx;
        height: 80rpx;
        border-radius: 15rpx;
      }

      .right {
        margin-left: 20rpx;

        .top {
          font-weight: 500;
          font-size: 28rpx;
          color: #000000e0;
          margin-bottom: 10rpx;
        }

        .bottom {
          font-weight: 500;
          font-size: 24rpx;
          color: #00000073;

          .text {
            margin: 0 10rpx;
          }
        }
      }

    }

    .b_bottom {
      display: flex;
      margin-top: 55rpx;
      align-items: center;


      text {
        margin-left: 10rpx;
        font-weight: 500;
        font-size: 24rpx;
        color: #000000a3;
      }
    }
  }

  .a_contain {
    width: 100%;
    height: calc(100vh - 140rpx);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .downLoad {
    font-size: 24rpx;
    color: #00000033;
    width: 100%;
    height: 80rpx;
    line-height: 80rpx;
    text-align: center;
    margin-bottom: 20rpx;
  }
}
</style>
  